package com.tssup.fesco.common.enumeration;

/**
 * Created by franco.cheng on 2017/3/14.
 */
public enum PayWay {

    POINT("积分支付", 1),
    WECHAT("微信支付", 2),
    CHECK("支票", 3),
    TRANSFER("银行转账", 4),
    ALIPAY("支付宝", 5),
    CREDIT_CARD("信用卡", 6),
    OTHERS("其他", 7),
    POINT_REFUND("积分退回", 8)
    ;

    private String desc;

    private Integer payWayId;

    PayWay(String desc, Integer payWayId){
        this.desc = desc;
        this.payWayId = payWayId;
    }

    public static String getPayWayDesc(Integer payWayId) {
        for (PayWay payWay : PayWay.values()) {
            if (payWay.getPayWayId().equals(payWayId)) {
                return payWay.getDesc();
            }
        }
        return null;
    }

    public static Integer getPayWayId(String desc) {
        for (PayWay payWay : PayWay.values()) {
            if (payWay.getDesc().equals(desc)) {
                return payWay.getPayWayId();
            }
        }
        return null;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Integer getPayWayId() {
        return payWayId;
    }

    public void setPayWayId(Integer payWayId) {
        this.payWayId = payWayId;
    }
}
